/******************************************************
*  Copyright(c) pages.ilovezxl.top
*  FileName : halagent.h
*  Author : rivulet.dave
*  Description : HAL内部头文件
*  Data : 2020-07-02
******************************************************/

#ifndef __HALAGENT_H__
#define __HALAGENT_H__

/*********************************************************************
 * INCLUDES
 */


#ifdef __cplusplus
extern "C" {
#endif

/*********************************************************************
 *  EXTERNAL VARIABLES
 */

/*********************************************************************
 * TYPES
 */

typedef hd_t(*hal_init_fxn_t)(void);
typedef void(*hal_exit_fxn_t)(void);

typedef struct _hal_operations
{
    hd_t    pThis;
    hd_t    (*pfOpen)(uint32_t uiIdx);
    int32_t (*pfClose)(hd_t pThis);
    int32_t (*pfRead)(hd_t pThis, uint8_t *pUserBuf, uint32_t uiSize, uint32_t uiFlag);
    int32_t (*pfWrite)(hd_t pThis, const uint8_t *pUserData, uint32_t uiSize, uint32_t uiFlag);
    int32_t (*pfReadOnce)(uint32_t uiIdx, uint8_t *pUserBuf, uint32_t uiSize, uint32_t uiFlag);
    int32_t (*pfWriteOnce)(uint32_t uiIdx, const uint8_t *pUserData, uint32_t uiSize, uint32_t uiFlag);
    int32_t (*pfCtrl)(hd_t pThis, uint32_t uiCmdKey, void *pValue);
    int32_t (*pfLock)(hd_t pThis, uint32_t uiFlag);
    int32_t (*pfUnlock)(hd_t pThis, uint32_t uiFlag);
} HAL_OPER_S;

/*********************************************************************
 * MACROS
 */


/*********************************************************************
 * FUNCTIONS
 */


#ifdef __cplusplus
}
#endif /* end of __cplusplus */

#endif  // __HALLIB_H__


